<template>
	<view>
		<page-head :pageTitle="coupon.comp_name" :backToggle="true"></page-head>
		<view class="container">
			<!-- :style="{height: height}" -->
			<view class="conpon_detail">
				<use-coupon :coupon="couponDetail"></use-coupon>
			</view>
		</view>
	</view>
</template>

<script>
	import couponModel from '../../model/coupon';
	
	import useCoupon from "../../components/coupon/usecoupon"
	const app = getApp()
	export default {
		data(){
			return {
				couponDetail:''
			}
		},
		components: {
			useCoupon
		},
		computed: {
			// height() {
			// 	return `calc(100vh - ${app.globalData.topHeight + 'px'}))`
			// }
		},
		onLoad(options) {
			this._options = options
		},
		onShow(){
			this.getCouponDetail()
		},
		methods:{
			getCouponDetail(){
				this.$api.wxApi.couponDetail({'act_id': this._options.actid, 'coupon_id': this._options.couponid}).then(res=>{
					console.log(couponModel.Detail.parse(res.data))
					this.couponDetail = couponModel.Detail.parse(res.data)
				})
			}
		}
		
	}
</script>

<style lang="scss" scoped>
	.container {
	  background: #f7f7f7;
	  // min-height: 100vh;
		height: calc(100vh - 65px);
	}
	.conpon_detail {
		padding: 30rpx;
		// background: #f7f7f7;
	}
</style>
